﻿using System;
using System.Web.Security;
using System.Collections.Generic;
using System.Web.Mvc;
using GameStepAzure.Areas.Admin.Models;
using System.Linq;

namespace GameStepAzure.Areas.Cliente.Controllers
{
    public class AdministracionClienteController : Controller
    {
        //
        // GET: /Cliente/AdministracionCliente/

        [Authorize(Roles = "Usuario")]
        public ActionResult Index()
        {
            return View();
        }

        [Authorize(Roles = "Usuario")]
        public ActionResult UsuarioPerfil()
        {
            List<Cliente.Models.DetalleCompra> detalleModelo = null;
            List<DetalleCompra> detallesEntity = null;
            using (GameStoreEntities context = new GameStoreEntities())
            {
                Guid user_id = new Guid(Convert.ToString(Membership.GetUser().ProviderUserKey));
                detallesEntity = context.DetalleCompra.ToList().FindAll(x => x.OrdenCompra.user_id.Equals(user_id));

                detalleModelo = GameStoreMapper.EntityToDetalleCompra(detallesEntity);
            
              
            }
            

            return View(detalleModelo);
        }
    }
}
